package com.hospital.warehouse.drugstock.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hospital.warehouse.drugstock.entity.Drugstock;
import com.hospital.warehouse.outstock.entity.Outstock;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author Mr. YR
 * @since 2020-04-21
 */
public interface DrugstockDao extends BaseMapper<Drugstock> {

	public <T> IPage<T> paging(@Param("po") T po, Page<T> page, @Param(Constants.WRAPPER) Wrapper<T> wrapper);

	public Drugstock queryById(Integer id);

	/**
	 * 通过药品id查询现有库存(已验收的入库单)，获得可用的批次
	 */
	public List<Drugstock> queryByDrugId(Integer id);

	/**
	 * 减少库存数量方法，传入Outstock中有入库单id和正数数量
	 * 
	 * @param Outstock
	 */
	public void reduceNum(@Param("po") Outstock po);
}
